package com.alongstudio.account.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;


/**
 * 收入/支出类别。
 * 
 * @ClassName: Category
 * @Description: 如果是默认的类别，则不需与用户绑定。
 * @author 安陈琳
 * @date Nov 30, 2011 3:39:13 PM
 * 
 */
@Entity
@Table(name = "tbl_category")
public class Category {
	@Id
	@Column(name = "id", length=32)
	@GeneratedValue(generator = "identityGenerator")
	@GenericGenerator(name = "identityGenerator", strategy = "com.alongstudio.account.commons.utils.IdentityGenerator")
	private String id;
	@Column(name = "category_name", length = 50)
	private String categoryName;
	@Column(name = "tree_code", length = 20)
	private String treeCode;// 树节点编号，唯一，用于父子关系处理，如1, 1.1, 1.2, 1.1.1, 1.1.2等
	@ManyToOne
	@JoinColumn(name = "fk_client_user_id")
	private ClientUser clientUser;// 系统用户
	@ManyToOne
	@JoinColumn(name = "fk_parent_id")
	private Category parent;// 父节点
	@Column(name = "has_child")
	private String hasChild;// 是否有子节点 0-无，1-有
	@Column(name = "sort_num")
	private Integer sortNum;// 同级中的排序，用于显示的时候的数据
	private Integer grade;// 级别，从1开始，每加一层增加1
	private String type;// 0-收入，1-支出
	@Column(name = "del_tag")
	private String delTag;//删除标记，Y-已删除，N-未删除
	@Column(name = "create_time")
	private Date createTime;
	@Column(name = "update_time")
	private Date updateTime;
	
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	
	public String getTreeCode() {
		return treeCode;
	}

	public void setTreeCode(String treeCode) {
		this.treeCode = treeCode;
	}

	public Integer getGrade() {
		return grade;
	}

	public void setGrade(Integer grade) {
		this.grade = grade;
	}

	public Integer getSortNum() {
		return sortNum;
	}

	public void setSortNum(Integer sortNum) {
		this.sortNum = sortNum;
	}

	public ClientUser getClientUser() {
		return clientUser;
	}

	public void setClientUser(ClientUser clientUser) {
		this.clientUser = clientUser;
	}


	public String getHasChild() {
		return hasChild;
	}

	public void setHasChild(String hasChild) {
		this.hasChild = hasChild;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getDelTag() {
		return delTag;
	}

	public void setDelTag(String delTag) {
		this.delTag = delTag;
	}

	public Category getParent() {
		return parent;
	}

	public void setParent(Category parent) {
		this.parent = parent;
	}

}
